# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Maintainer: Bruno Pagani <archange@archlinux.org>
# Contributor: Lukas Jirkovsky <l.jirkovsky@gmail.com>

pkgname=embree3
pkgver=3.13.5
pkgrel=2
pkgdesc="Collection of high-performance ray tracing kernels"
arch=('loong64' 'x86_64')
url="https://embree.github.io/"
license=('Apache')
depends=('intel-tbb')
makedepends=('cmake' 'ispc' 'freeglut' 'libxmu' 'ninja')
source=(https://github.com/embree/embree/archive/v${pkgver}/embree-${pkgver}.tar.gz)
sha256sums=('b8c22d275d9128741265537c559d0ea73074adbf2f2b66b0a766ca52c52d665b')

build() {
    cmake \
      -B build \
      -G Ninja \
      -S embree-${pkgver} \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DCMAKE_INSTALL_LIBDIR=lib \
      -DCMAKE_BUILD_TYPE=Release \
      -DEMBREE_TUTORIALS=OFF \
      -DEMBREE_MAX_ISA="AVX512SKX" \
      -DEMBREE_RAY_MASK=ON \
      -DEMBREE_FILTER_FUNCTION=ON \
      -DEMBREE_BACKFACE_CULLING=OFF
    # Embree detects actual ISA at runtime
    ninja -C build
}

package() {
    DESTDIR="${pkgdir}" ninja -C build install
}
